<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学习使用vue的第一个页面</title>
    <style>
        [v-cloak] {
            display: none;
        }
    </style>
</head>

<body>

    <div id="app">
        <div>{{msg}}</div>
        <!-- 数据的双向绑定 -->
        <input type="text" name="" value="" v-model="msg">
        <div v-cloak>{{num}}</div>
        <div>
            <button v-on:click='num++'>点击我</button>
        </div>
        <div v-on:click="pop">
            <button v-on:click.stop="handler">事件绑定调用函数</button>
        </div>

        <div>
            <button @click="handler1('hahaha' , 'whwhwh', $event)">事件绑定调用函数2</button>
        </div>

        <div>
            <a href="http://www.baidu.com" target="_blank" v-on:click.prevent="jump">跳转链接</a>
        </div>
    </div>

    <script src="./js/vue.js"></script>

    <script>
        var vm = new Vue({
            el: '#app',
            data: ({
                msg: 'Hello Vue',
                num: 0
            }),
            methods: {
                handler: function (event) {
                    console.log(event.target.innerHTML);
                    this.num++
                    // event.stopPropagation();
                    // 阻止了冒泡事件
                },
                handler1: function (param1, param2, event) {
                    console.log(event.target.innerHTML);
                    console.log(param1, param2);
                    this.num++
                },
                pop: function (event) {
                    console.log("我冒泡上来了-------");

                },
                jump: function (event) {

                    // event.preventDefault();

                }
            },
        });
    </script>
</body>

</html>


<!-- vue框架的基本模型思想  mvvm  View(html架构) → ViewModule(vue框架 ) → modle（数据结构层） -->